﻿<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>联系记录</title>
    <!-- Bootstrap -->
    <link href="/CSS/bootstrap3.3.5/css/bootstrap.css" rel="stylesheet">
    <link href="/CSS/Base/BaseClass.css" rel="stylesheet">
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body ms-controller="APP_KHGL_LXJL">
    <div class="container-fluid maindiv" style="padding: 20px;margin:0" id="dvContent">
        <table class="table table-bordered table-hover table-striped">
            <thead><tr><th colspan="6" class="text-center">客户资料</th></tr> </thead>
            <tbody>
                <tr>
                    <th class="text-right">客户姓名</th>
                    <td>{{modelData.KHName}}</td>
                    <th class="text-right">客户性别</th>
                    <td>{{modelData.KHXinBie}}</td>
                    <th class="text-right">职务</th>
                    <td>{{modelData.KHZhiWu}}</td>
                </tr>
                <tr>
                    <th class="text-right">座机</th>
                    <td>{{modelData.KHZJ}}</td>
                    <th class="text-right">客户电话</th>
                    <td>{{modelData.KHPhone}}</td>
                    <th class="text-right">邮箱</th>
                    <td>{{modelData.KHEmail}}</td>
                </tr>
                <tr>
                    <th class="text-right">种类</th>
                    <td>{{modelData.KHLeiBie}}</td>
                    <th class="text-right">所属单位</th>
                    <td>{{modelData.KHDW}}</td>
                    <th class="text-right">负责人</th>
                    <td>{{ComFunJS.convertuser(modelData.KHFXRS)}}</td>
                </tr>
                <tr>

                    <th class="text-right">联系地址</th>
                    <td>{{modelData.KHAdress}}</td>
                    <th class="text-right">家庭住址</th>
                    <td colspan="3">{{modelData.KHJTZZ}}</td>
                </tr>
                <tr>
                    <th class="text-right">备注</th>
                    <td colspan="5" ms-html="modelData.Remark"></td>

                </tr>
            </tbody>

        </table>

        <div class="chat-widget panel panel-body" style="margin-top: 10PX; margin-bottom: 10px">
            <div class="panel-heading">联系记录</div>
            <ul class="list-unstyled" style="margin-top: 10PX;">
                <li class="by-me Yan-comment" ms-repeat-item="LXDataList">
                    <div class="avatar" style="float: left">
                        <img alt="" ms-attr-src="'/Upload/TX/'+item.CRUser+'.jpg'" style="width:55px;height:55px" onerror="javascript: this.src = '/images/TX/default.png'">
                    </div>
                    <div class="chat-content">
                        <div class="chat-meta">{{item.LXR}} <span style="float: right">{{item.CRDate|date("yyyy-MM-dd HH:mm")}}</span></div>
                        <span class="label label-info" style="margin-right:5px">{{item.LXLB}} </span> {{item.LXContent}}
                    </div>
                </li>
            </ul>
        </div>


        <div class="input-group">
            <select class="form-control" ms-duplex="modelLXData.LXLB" style="width:25%">
                <option value="打电话">打电话</option>
                <option value="发邮件">发邮件</option>
                <option value="发短信">发短信</option>
                <option value="见面拜访">见面拜访</option>
                <option value="汇报记录">汇报记录</option>
                <option value="活动">活动</option>
            </select>
            <input type="text" class="form-control" style="width:75%" ms-duplex="modelLXData.LXContent" placeholder="此处输入联系记录">
            <span class="input-group-btn">
                <button class="btn btn-info" type="button" ms-click="SaveData()">添加联系记录</button>
            </span>
        </div>
    </div>
    <script src="/Scripts/jquery-1.11.2.min.js"></script>
    <script src="/CSS/bootstrap3.3.5/js/bootstrap.js"></script>
    <script src="/Scripts/avalon.js"></script>
    <script src="/Scripts/SZHLCommon.js?jsver=5"></script>
    <script>
        var model = avalon.define({
            $id: "APP_KHGL_LXJL",
            modelData: {},
            khID: ComFunJS.getQueryString("ID", 0),
            modelLXData: { LXLB: "打电话", LXContent: "", RefID: 0 },
            LXDataList: [],
            initForm: function () {
                if (model.khID) {
                    model.modelLXData.RefID = model.khID;
                    //编辑加载数据
                    $.getJSON('/API/FTAPI.ashx?Action=GETKHGLMODEL', { P1: model.khID }, function (resultData) {
                        if (resultData.ErrorMsg == "") {
                            model.modelData = resultData.Result;
                            model.LXDataList = resultData.Result1;
                        }
                    })
                }
            },//初始化
            SaveData: function () {
                if (model.modelLXData.LXLB == "") {
                    parent.ComFunJS.winwarning("请选择类别");
                    return;
                }
                if (model.modelLXData.LXContent == "") {
                    parent.ComFunJS.winwarning("请填写联系记录内容");
                    return;
                }
                var data = model.modelLXData.$model;
                var modelValue = JSON.stringify(data);
                $.post("/API/FTAPI.ashx?ACTION=ADDKHLSJL", { P1: modelValue }, function (result) {
                    var jsonresult = $.parseJSON(result)
                    if ($.trim(jsonresult.ErrorMsg) == "") {
                        parent.ComFunJS.winsuccess("操作成功");
                        model.modelLXData.LXContent = "";
                        model.LXDataList.push(jsonresult.Result);
                    }
                });
            }
        });
        avalon.ready(function () {
            model.initForm();
        })
    </script>
</body>
</html>